<template>
  <div>
    <h3>欢饮光临-vue开发的收银系统-水果店</h3>
    <hr />
    <b>苹果{{ title }}￥/斤，折扣,{{ index }}折</b>
    <br />
    <input type="text" placeholder="请输入你要购买的斤数" v-model="sum" />
    <br />
    <button @click="fn(sum)">结账买单</button>
    <br />
    <p>结账单：总价{{ mge }}￥元折后价：{{ egg }}￥元省了：{{ agg }}￥元</p>
  </div>
</template>

<script>
export default {
  add: "",
  components: {},
  props: {},
  data() {
    return {
      title: 10,
      index: 8,
      mge: "",
      egg: "",
      agg: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    fn(sum) {
      this.mge = this.title * sum;
      this.egg = this.index * sum;
      this.agg = this.mge - this.egg;
    },
  },
};
</script>

<style scoped></style>
